package com.haixiaoke.saas.enterprise.task;

import com.haixiaoke.saas.bill.service.IHouseBillService;
import com.haixiaoke.saas.bill.service.IProprietorBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 账单定时任务
 *
 * @author qixi
 * @date 2024-5-29
 */
@Component
public class BillTask {


    @Autowired
    private IProprietorBillService proprietorBillService;

    @Autowired
    private IHouseBillService houseBillService;


    /**
     * 每天0点执行业主账单超时任务
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void proprietorBillOvertimeTask() {
        proprietorBillService.proprietorBillOvertimeTask();
    }

    /**
     * 每天0点执行入住账单超时任务
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void houseBillOvertimeTask() {
        houseBillService.houseBillOvertimeTask();
    }


    /**
     * 每天0.05执行房屋账单生效更新任务
     */
    @Scheduled(cron = "0 5 0 * * ?")
    public void houseBillActivationTask() {
        houseBillService.houseBillActivationTask();
    }

    /**
     * 每天0.05执行违约金生成任务
     */
    @Scheduled(cron = "0 5 0 * * ?")
    public void penaltyBillTask() {
        houseBillService.penaltyBillTask();
    }

}
